<?php

namespace app\admin\common;

/**
 * Class ServiceResponse
 * @package app\admin\common
 */

trait ServiceResponse
{
    protected function success($data = [], $code = 0, $message = ''): array
    {
        return [
            'code' => $code,
            'data' => $data,
            'message' => $message
        ];
    }

    protected function error(int $code, string $message = '', $data = null): array
    {
        return [
            'code' => $code,
            'message' => $message
        ];
    }
}
